<template>
  <page-view :title="title">
    <a-card :bordered="false">
      <detail-list title="病房信息">
        <detail-list-item term="id">{{ data.id }}</detail-list-item>
        <detail-list-item term="病房号">{{ data.number }}</detail-list-item>
        <detail-list-item term="床位数">{{ data.count }}</detail-list-item>
      </detail-list>
      <detail-list title="病房人员信息">
        <detail-list-item term="姓名"></detail-list-item>
        <detail-list-item term="病房号"></detail-list-item>
        <detail-list-item term="床位数"></detail-list-item>
      </detail-list>
      <a-divider style="margin-bottom: 32px"/>
      <a-button style="margin-left: 8px" @click="goBack()">返回</a-button>
    </a-card>
  </page-view>
</template>

<script>
import { PageView } from '@/layouts'
import DetailList from '@/components/tools/DetailList'
import { getBed } from '../../api/bed'

const DetailListItem = DetailList.Item

export default {
  name: 'ShowBed',
  data () {
    return {
      data: {}
    }
  },
  components: {
    PageView,
    DetailList,
    DetailListItem
  },
  computed: {
    title () {
      return this.$route.meta.title
    }
  },
  methods: {
    initValue () {
      getBed(this.id).then(res => {
        console.log('doctor', res.result)
        this.data = res.result
      })
    },
    goBack () {
      this.$router.push('/bed/index')
    }
  },
  mounted () {
    this.id = this.$route.query.id
    if (this.id === null || this.id === undefined) {
      this.$router.push('/bed/index')
    } else {
      this.initValue()
    }
  }
}
</script>

<style scoped>
  .title {
    color: rgba(0,0,0,.85);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
  }
</style>
